package com.example.springbott.wx_controller;

import com.example.springbott.bean.BaseRespVo;
import com.example.springbott.bean.MarketTopic;
import com.example.springbott.bean.common.CommonData;
import com.example.springbott.vo.WxTopicDetail;
import com.example.springbott.wx_service.WxTopicService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 付常莹
 * @description: TODO
 * @date 2022/11/22 14:25
 * 该Controller用于小程序的专题模块
 */
@RestController
@RequestMapping("/wx/topic")
public class WxTopicController {
    @Resource
    WxTopicService wxTopicService;

    /**
     * 该方法用于查找显示专题
     * @param page
     * @param limit
     * @return
     */
    @GetMapping("list")
    public BaseRespVo list(Integer page,Integer limit){
       CommonData<MarketTopic> data =  wxTopicService.list(page,limit);
       return BaseRespVo.ok(data);
    }



    /**
     * 该方法用于显示专题细节
     * @return
     */
    @GetMapping("detail")
    public BaseRespVo detail(Integer id){
       WxTopicDetail data =  wxTopicService.detail(id);
       return BaseRespVo.ok(data);
    }


    /**
     * 该方法同样用于专题展示
     * @return
     */
    @GetMapping("related")
    public BaseRespVo related(Integer id){
        CommonData<MarketTopic> data=wxTopicService.related(id);
        return BaseRespVo.ok(data);
    }

}
